<?php
use Buan\View;

View::getGlobalView()->addStylesheets("{$baseUrl}/front-end.css");
$content = isset($page) ? $page->getOuterContent()->content : new StdClass();
$content->head = isset($content->head) && $content->head!='' ? $content->head : 'Scribble!';
?>
<html>
<head>
	<title>Scribble</title>
	<?php echo $this->getView()->getStylesheetsView()->renderAfter($this->getView(), $this->getView()); ?>
</head>
<body class="<?php echo $content->bodyTheme; ?>">
	<div id="wrap">
		<div id="head">
			<h1><?php $this->html->e($content->head); ?></h1>
			<ul id="nav">
			<?php foreach($menus as $m): ?>
				<li>
					<a href="<?php $this->html->e($m->getAbsoluteUrl()); ?>"><?php $this->html->e($m->name); ?></a>

					<!-- Sub depth 1 -->
					<?php if(!$m->_children->isEmpty()): ?>
						<ul>
						<?php foreach($m->_children as $s1): ?>
							<li>
								<a href="<?php $this->html->e($s1->getAbsoluteUrl()); ?>"><?php $this->html->e($s1->name); ?></a>

								<!-- Sub depth 2 -->
								<?php if(!$s1->_children->isEmpty()): ?>
									<ul>
									<?php foreach($s1->_children as $s2): ?>
										<li>
											<a href="<?php $this->html->e($s2->getAbsoluteUrl()); ?>"><?php $this->html->e($s2->name); ?></a>
										</li>
									<?php endforeach; ?>
									</ul>
								<?php endif; ?>
							</li>
						<?php endforeach; ?>
						</ul>
					<?php endif; ?>
				</li>
			<?php endforeach; ?>
			</ul>
			<div class="clear">&#160;</div>
		</div>

		<div id="inner">
			<?php echo $this->getView()->getSlot('action')->render(); ?>
		</div>

		<?php if(isset($content->wittyprose) && $content->wittyprose!=''): ?>
			<div id="wit">
				<?php echo $content->wittyprose; ?>
			</div>
		<?php endif; ?>

		<div id="footer">
			&#169; <?php echo date("Y"); ?> scribblecms.co.uk
		</div>
	</div>

	<?php echo $this->getView()->getJavascriptsView()->renderAfter($this->getView(), $this->getView()); ?>
</body>
</html>